<template>
  <div>
    <a-card :bordered="false" style="margin-bottom: 10px">
      <!-- 条件搜索 -->
      <div class="table-page-search-wrapper">
        <a-form :labelCol="labelCol" :wrapperCol="wrapperCol" ref="queryForm">
          <a-row :gutter="32">
            <a-col :span="4">
              <a-form-item label="线索类型" prop="laiyuanType">
                <a-select
                  placeholder="线索类型"
                  v-model="queryParam.laiyuanType"
                  style="width: 100%"
                  allow-clear
                  @change="onLaiyuanChange"
                >
                  <a-select-option
                    v-for="(d, index) in [
                      { dictValue: '1', dictLabel: '广告' },
                      { dictValue: '2', dictLabel: '自建' },
                    ]"
                    :key="index"
                    :value="d.dictValue"
                    >{{ d.dictLabel }}</a-select-option
                  >
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="4">
              <a-form-item label="线索来源" prop="type">
                <a-select
                  placeholder="选择线索来源"
                  v-model="queryParam.laiyuanMultiple"
                  style="width: 100%"
                  allow-clear
                  mode="multiple"
                >
                  <a-select-option
                    v-for="(d, index) in laiyuanOptions"
                    :key="index"
                    :value="d.dictValue"
                    >{{ d.dictLabel }}</a-select-option
                  >
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="4">
              <a-form-item label="姓名">
                <a-input
                  v-model="queryParam.cusName"
                  placeholder="请输入客户姓名"
                  allow-clear
                  @keyup.enter.native="handleQuery"
                />
              </a-form-item>
            </a-col>

            <a-col :span="4">
              <a-form-item label="电话">
                <a-input
                  v-model="queryParam.phone"
                  placeholder="请输入客户电话"
                  allow-clear
                  @keyup.enter.native="handleQuery"
                />
              </a-form-item>
            </a-col>

            <a-col :span="4">
              <a-form-item label="跟进状态" prop="status">
                <a-select
                  placeholder="选择跟进状态"
                  v-model="queryParam.progressMultiple"
                  style="width: 100%"
                  allow-clear
                  mode="multiple"
                >
                  <a-select-option
                    v-for="(d, index) in progressOptions"
                    :key="index"
                    :value="d.dictValue"
                    >{{ d.dictLabel }}</a-select-option
                  >
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="4" v-if="advanced">
              <a-form-item label="星级" prop="level">
                <a-select
                  placeholder="选择星级"
                  v-model="queryParam.levels"
                  style="width: 100%"
                  allow-clear
                  mode="multiple"
                >
                  <a-select-option
                    v-for="(d, index) in levelOptions"
                    :key="index"
                    :value="d.dictValue"
                    >{{ d.dictLabel }}</a-select-option
                  >
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="4">
              <a-form-item label="车辆状态" prop="status" v-if="advanced">
                <a-select
                  placeholder="选择车辆状态"
                  v-model="queryParam.carStatus"
                  style="width: 100%"
                  allow-clear
                >
                  <a-select-option
                    v-for="(d, index) in carStatusOptions"
                    :key="index"
                    :value="d.dictValue"
                    >{{ d.dictLabel }}</a-select-option
                  >
                </a-select>
              </a-form-item>
            </a-col>

            <a-col :span="4" v-if="advanced">
              <a-form-item label="评估价格" class="auto-width-form-item">
                <div class="input-number-wrapper">
                  <a-input-number
                    v-model="queryParam.pgPriceMin"
                    :min="0"
                    :max="10000"
                    placeholder="最小值"
                    :formatter="(value) => `${value}万`"
                    :parser="(value) => value.replace('万', '')"
                    :precision="1"
                    allow-clear
                    class="auto-width-input"
                  />
                  <span class="separator"> ~ </span>
                  <a-input-number
                    v-model="queryParam.pgPriceMax"
                    :min="0"
                    :max="10000"
                    placeholder="最大值"
                    :formatter="(value) => `${value}万`"
                    :parser="(value) => value.replace('万', '')"
                    :precision="1"
                    allow-clear
                    class="auto-width-input"
                  />
                </div>
              </a-form-item>
            </a-col>
            <a-col :md="4" :sm="24" v-if="advanced">
              <a-form-item label="推送时间">
                <a-range-picker
                  style="width: 100%"
                  v-model="dateRange"
                  valueFormat="YYYY-MM-DD"
                  format="YYYY-MM-DD"
                  allow-clear
                />
              </a-form-item>
            </a-col>
            <a-col :md="4" :sm="24" v-if="advanced">
              <a-form-item label="最后跟进">
                <a-range-picker
                  style="width: 100%"
                  v-model="dateRangeEndTime"
                  valueFormat="YYYY-MM-DD"
                  format="YYYY-MM-DD"
                  allow-clear
                />
              </a-form-item>
            </a-col>

            <a-col :span="4" v-if="advanced">
              <a-form-item label="城市区域" prop="type">
                <a-select
                  placeholder="所在城市"
                  v-model="queryParam.cityNames"
                  style="width: 100%"
                  mode="multiple"
                  allow-clear
                >
                  <a-select-option
                    v-for="(d, index) in cityOptions"
                    :key="index"
                    :value="d.name.replace('市', '')"
                    >{{ d.name }}</a-select-option
                  >
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="4" v-if="advanced">
              <a-form-item label="是否重复">
                <a-select v-model="queryParam.isRep" allow-clear>
                  <a-select-option key="0" value="0">新客户</a-select-option>
                  <a-select-option key="1" value="1">重复客户</a-select-option>
                </a-select>
              </a-form-item>
            </a-col>

            <a-col :span="4" v-if="false">
              <a-form-item label="部门" prop="type">
                <a-tree-select
                  v-model="queryParam.deptId"
                  style="width: 100%"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  :tree-data="deptOptions"
                  placeholder="请选择"
                  :replaceFields="{
                    children: 'children',
                    title: 'menuName',
                    key: 'id',
                    value: 'id',
                  }"
                  @change="onMenuTreeChange"
                  allow-clear
                >
                </a-tree-select>
              </a-form-item>
            </a-col>
            <a-col :span="4" v-if="false">
              <a-form-item label="客户经理">
                <a-select
                  placeholder="请选择客户经理"
                  v-model="queryParam.userId"
                  :getPopupContainer="
                    (triggerNode) => {
                      return triggerNode.parentNode || document.body;
                    }
                  "
                  style="width: 100%"
                  allow-clear
                >
                  <a-select-option
                    v-for="d in userNamesList"
                    :key="d.name"
                    :value="d.id"
                    >{{ d.name }}</a-select-option
                  >
                </a-select>
              </a-form-item>
            </a-col>

            <a-col>
              <span
                class="table-page-search-submitButtons"
                style="float: right"
              >
                <a-button type="primary" @click="handleQuery"
                  ><a-icon type="search" />查询</a-button
                >
                <a-button style="margin-left: 8px" @click="resetQuery"
                  ><a-icon type="redo" />刷新</a-button
                >
                <a @click="toggleAdvanced" style="margin-left: 8px">
                  {{ advanced ? "收起" : "展开" }}
                  <a-icon :type="advanced ? 'up' : 'down'" />
                </a>
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </a-card>
    <a-card :bordered="false" class="table-card">
      <!-- 增加 -->
      <biz-customer-add-form
        v-if="showAddImportModal"
        ref="bizCustomerAddForm"
        :typeOptions="typeOptions"
        :levelOptions="levelOptions"
        :progressOptions="progressOptions"
        :statusOptions="statusOptions"
        :ideasTypeOptions="ideasTypeOptions"
        :zxInfoOptions="zxInfoOptions"
        :zhichanInfoOptions="zhichanInfoOptions"
        :genjinQuckitInputOptions="genjinQuckitInputOptions"
        :sexOptions="sexOptions"
        :fujianTypeOptions="fujianTypeOptions"
        :carTypeOptions="carTypeOptions"
        @ok="getList"
        @close="showAddImportModal = false"
      />
      <biz-customer-add-info-form
        v-if="showAddInfoModal"
        ref="bizCustomerAddInfoForm"
        :typeOptions="typeOptions"
        :levelOptions="levelOptions"
        :progressOptions="progressOptions"
        :statusOptions="statusOptions"
        :ideasTypeOptions="ideasTypeOptions"
        :zxInfoOptions="zxInfoOptions"
        :zhichanInfoOptions="zhichanInfoOptions"
        :genjinQuckitInputOptions="genjinQuckitInputOptions"
        :sexOptions="sexOptions"
        :fujianTypeOptions="fujianTypeOptions"
        :carTypeOptions="carTypeOptions"
        @ok="getList"
        @close="showAddInfoModal = false"
      />
      <!-- 编辑 -->
      <biz-customer-edit-form
        v-if="showEditModal"
        ref="bizCustomerEditForm"
        :typeOptions="typeOptions"
        :levelOptions="levelOptions"
        :progressOptions="progressOptions"
        :statusOptions="statusOptions"
        :ideasTypeOptions="ideasTypeOptions"
        :zxInfoOptions="zxInfoOptions"
        :zhichanInfoOptions="zhichanInfoOptions"
        :genjinQuckitInputOptions="genjinQuckitInputOptions"
        :sexOptions="sexOptions"
        :fujianTypeOptions="fujianTypeOptions"
        :carTypeOptions="carTypeOptions"
        @ok="getList"
        @close="showEditModal = false"
      />
      <!--跟进记录-->
      <biz-customer-info-shadow-form
        v-if="showShadowModal"
        ref="bizCustomerInfoShadowForm"
        :typeOptions="typeOptions"
        :levelOptions="levelOptions"
        :progressOptions="progressOptions"
        :statusOptions="statusOptions"
        :ideasTypeOptions="ideasTypeOptions"
        :zxInfoOptions="zxInfoOptions"
        :zhichanInfoOptions="zhichanInfoOptions"
        :genjinQuckitInputOptions="genjinQuckitInputOptions"
        :sexOptions="sexOptions"
        :fujianTypeOptions="fujianTypeOptions"
        :carTypeOptions="carTypeOptions"
        @ok="getList"
        @close="showShadowModal = false"
        :eidtshow="true"
      />
      <!-- 预审-->
      <biz-yushen-info-add-form
        v-if="showAddModal"
        ref="bizYushenInfoAddForm"
        @ok="handleShowRes"
        @close="handleShowCancel"
      />
      <!-- 类型选择 -->
      <chose-modal
        v-if="showTypeModal"
        ref="choseModal"
        :choseOptions="choseOptions"
        :title="'选择转移客户状态'"
        @ok="typeModalOk"
        @close="showTypeModal = false"
      />

      <!-- 拉黑原因选择 -->
      <to-heimingdan-modal
        v-if="showToHeiReasonModal"
        ref="toHeiReasonModal"
        :toHeimingdanReasonOptions="toHeimingdanReasonOptions"
        :title="'选择拉黑原因'"
        @ok="toHeiReasonModalOk"
        @close="showToHeiReasonModal = false"
      />

      <a-tabs default-active-key="all" @change="callback">
        <a-tab-pane key="all" tab="全部"> </a-tab-pane>
        <a-tab-pane key="today" tab="今日新增"> </a-tab-pane>
        <a-tab-pane key="sanday" tab="超过三天未跟进"> </a-tab-pane>
        <a-tab-pane key="lock" tab="我的锁定"> </a-tab-pane>
        <a-tab-pane key="receive" tab="我的接单">
          <!-- 我的接单 -->
          <advance-table
            title="客户信息"
            :pagination="{
              current: queryParam.pageNum,
              pageSize: queryParam.pageSize,
              total: total,
              showSizeChanger: true,
              showLessItems: true,
              showQuickJumper: true,
              showTotal: (total, range) =>
                `第 ${range[0]}-${range[1]} 条，总计 ${total} 条`,
              onChange: changeSize,
              onShowSizeChange: onShowSizeChange,
              pageSizeOptions: pageSizeOptions,
            }"
            tableKey="base-bizCustomer-index-table-myindex-receive"
            rowKey="reveice_Id"
            size="middle"
            @refresh="getList"
            @change="handleTableChange"
            :columns="receiveColumns"
            :data-source="bizCustomerReceiveList"
            :loading="loading"
            :format-conditions="true"
            :row-selection="{
              selectedRowKeys: selectedRowKeys,
              onChange: onSelectChange,
            }"
            :scroll="{ x: '100%' }"
          >
            <div class="table-operations" slot="button">
              <a-button @click="handleAddYuShen()" class="addJinjian">
                <a-icon type="solution" />预审申请
              </a-button>
            </div>

            <span slot="status" slot-scope="{ text, record }">
              <a-tag v-if="text == '0'" color="#2db7f5">{{
                statusFormat(record)
              }}</a-tag>
              <a-tag v-if="text == '1'" color="#87d068">{{
                statusFormat(record)
              }}</a-tag>
              <a-tag
                v-if="text == '-99' || text == '-88'"
                @click="handleShare(record)"
                color="#f50"
                >{{ statusFormat(record) }}</a-tag
              >
            </span>

            <span slot="cusName" slot-scope="{ text, record }">
              <a-tooltip :title="ownTpyeRemarkFormat(record)">
                <a-tag color="red">{{ ownTpyeFormat(record) }}</a-tag>
              </a-tooltip>

              <a @click="handleShadow(record)" style="color: #f56c6c">
                {{ text }}
              </a>

              <a-popover
                title="推送记录"
                trigger="hover"
                placement="rightBottom"
              >
                <template #content>
                  <template v-if="record.pushList">
                    <p v-for="(item, index) in record.pushList" :key="index">
                      {{ item.laiyuan }} {{ item.createTime }}
                    </p>
                  </template>
                  <p v-else>{{ "" }}</p>
                </template>
                <template
                  v-if="
                    record.pushList &&
                    record.pushList.filter((item) => item.isRep === 1).length >
                      0
                  "
                >
                  <a-badge
                    :count="record.pushList.length"
                    :number-style="{
                      backgroundColor: '#fff',
                      color: '#999',
                      boxShadow: '0 0 0 1px #d9d9d9 inset',
                      fontSize: '10px', // 减小字体大小
                    }"
                  >
                  </a-badge>
                </template>
              </a-popover>

              <template v-if="record.isAllowEdit === 0">
                <a-icon
                  type="star"
                  v-if="record.isHeart == 2"
                  theme="filled"
                  style="color: #f50; font-size: 14px; margin-left: 5px"
                ></a-icon>
                <a-icon
                  type="star"
                  v-else
                  style="
                    color: rgb(243 125 66);
                    font-size: 14px;
                    margin-left: 5px;
                  "
                ></a-icon>

                <!-- <a-icon
                  type="lock"
                  v-if="record.isLock == 1"
                  theme="filled"
                  style="color: #f50; font-size: 14px; margin-left: 5px"
                ></a-icon>
                <a-icon
                  type="unlock"
                  v-else
                  style="
                    color: rgb(243 125 66);
                    font-size: 14px;
                    margin-left: 5px;
                  "
                ></a-icon> -->
              </template>
              <template v-else>
                <a-icon
                  type="star"
                  v-if="record.isHeart == 2"
                  theme="filled"
                  style="color: #f50; font-size: 14px; margin-left: 5px"
                  @click="handleHeartCancel(record)"
                ></a-icon>
                <a-icon
                  type="star"
                  v-else
                  style="
                    color: rgb(243 125 66);
                    font-size: 14px;
                    margin-left: 5px;
                  "
                  @click="handleHeart(record)"
                ></a-icon>

                <!-- <a-icon
                  type="lock"
                  v-if="record.isLock == 1"
                  theme="filled"
                  style="color: #f50; font-size: 14px; margin-left: 5px"
                  @click="handleLockCancel(record)"
                ></a-icon>
                <a-icon
                  type="unlock"
                  v-else
                  style="
                    color: rgb(243 125 66);
                    font-size: 14px;
                    margin-left: 5px;
                  "
                  @click="handleLock(record)"
                ></a-icon> -->
              </template>
            </span>
            <span slot="rowindex" slot-scope="{ index }">
              {{ index + 1 }}
            </span>
            <span slot="phone" slot-scope="{ text, record }">
              <!-- <template v-if="record.isAllowEdit === 0">
                <a
                  @click="handleShadow(record)"
                  v-if="text"
                  style="color: #f56c6c"
                >
                  {{ "*******" + text.substring(7, 11) }}
                </a>
              </template> -->
              <template>
                <a-icon
                  type="phone"
                  theme="filled"
                  style="color: #269f70"
                  :rotate="rotate"
                  @click="handcallPhone(record)"
                />
                <a
                  @click="handleShadow(record)"
                  v-if="text"
                  style="color: #f56c6c"
                >
                  {{ "*******" + text.substring(7, 11) }}
                </a>
              </template>
            </span>
            <span slot="type" slot-scope="{ record }">
              {{ typeFormat(record) }}
            </span>
            <span slot="level" slot-scope="{ record }">
              <template v-if="record.isAllowEdit === 0">
                <a-rate v-model="record.level" disabled
              /></template>
              <template v-else>
                <a-rate
                  v-model="record.level"
                  @change="handleClueRate(record)"
                />
              </template>
            </span>
            <span slot="progress" slot-scope="{ text, record }">
              <template v-if="record.isAllowEdit === 0">
                {{ busProgressFormat(record) }}
              </template>
              <template v-else>
                <a-select
                  v-model="record.progress"
                  style="width: 100%"
                  allow-clear
                  @change="updateInfo(record)"
                >
                  <a-select-option
                    v-for="(d, index) in progressOptions"
                    :key="index"
                    :value="d.dictValue"
                    >{{ d.dictLabel }}</a-select-option
                  >
                </a-select>
              </template>
            </span>
            <span slot="pgPrice" slot-scope="{ text, record }">
              <template v-if="record.isAllowEdit === 0">
                <span v-if="text"> {{ text }}万 </span>
                <span v-else></span>
              </template>
              <template v-else>
                <a-input-number
                  v-model="record.pgPrice"
                  :min="0"
                  :max="10000"
                  placeholder="最小值"
                  :formatter="(value) => `${value}万`"
                  :parser="(value) => value.replace('万', '')"
                  :precision="2"
                  allow-clear
                  @blur="updateInfo(record)"
                />
              </template>
            </span>
            <span slot="carStatus" slot-scope="{ text, record }">
              <template v-if="record.isAllowEdit === 0">
                {{ text }}
              </template>
              <template v-else>
                <a-select
                  v-model="record.carStatus"
                  style="width: 100%"
                  allow-clear
                  @change="updateInfo(record)"
                >
                  <a-select-option
                    v-for="(d, index) in carStatusOptions"
                    :key="index"
                    :value="d.dictValue"
                    >{{ d.dictLabel }}</a-select-option
                  >
                </a-select>
              </template>
            </span>
            <span slot="userName" slot-scope="{ text, record }">
              <span v-if="record.status == '-3'"> 黑名单客户 </span>
              <span v-else-if="record.status == '7'"> 公海客户 </span>
              <span v-else>
                <span v-if="record.userName">
                  {{ record.userName }}
                </span>
                <span v-else> </span>
              </span>
            </span>
            <span slot="isDail" slot-scope="{ text }">
              <a-tag v-if="text == '0'" color="#2db7f5"> 待拨打</a-tag>
              <a-tag v-if="text == '1'" color="#87d068"> 已拨打</a-tag>
            </span>
            <span slot="businessStatus" slot-scope="{ record }">
              <a-tag color="#2db7f5"> {{ businessStatusFormat(record) }}</a-tag>
            </span>
            <span slot="amount" slot-scope="{ text }">
              ¥ {{ parseFloat(text || 0).toFixed(2) }}
            </span>
            <span slot="isLock" slot-scope="{ text, record }">
              <a-popconfirm
                ok-text="是"
                cancel-text="否"
                @confirm="confirmHandleStatus(record)"
                @cancel="cancelHandleStatus(record)"
              >
                <span slot="title"
                  >确认<b>{{ record.isLock == "0" ? "锁定" : "解锁" }}</b
                  >{{ record.cusName }}吗?</span
                >
                <a-switch
                  checked-children="锁"
                  un-checked-children="未锁"
                  :checked="record.isLock == 1"
                />
              </a-popconfirm>
            </span>

            <span slot="contactStatus" slot-scope="{ text, record }">
              <span v-if="record.shadowList && record.shadowList.length > 0">
                {{
                  record.shadowList[0].phoneStatus
                    ? record.shadowList[0].phoneStatus
                    : ""
                }}
                {{
                  record.shadowList[0].phoneStatus &&
                  record.shadowList[0].vxStatus
                    ? "-"
                    : ""
                }}
                {{
                  record.shadowList[0].vxStatus
                    ? record.shadowList[0].vxStatus
                    : ""
                }}</span
              >
              <p v-else>{{ "" }}</p>
            </span>
            <span slot="genjinInfo" slot-scope="{ text, record }">
              <a-popover
                title="跟进记录"
                trigger="hover"
                placement="top"
                :visible="record.ispop"
                @visibleChange="(v) => handleClickChange(v, record)"
              >
                <template #content>
                  <div style="position: relative">
                    <template v-if="text">
                      <a-timeline>
                        <a-timeline-item
                          v-for="(item, index) in record.shadowList"
                          :key="index"
                          :color="item.color"
                        >
                          {{ item.takes }} {{ item.createTime }}
                        </a-timeline-item>
                      </a-timeline>
                    </template>
                    <p v-else>{{ "" }}</p>
                    <a-button
                      type="link"
                      style="position: absolute; right: 0; bottom: 0"
                      @click="genjinClick(record)"
                    >
                      更多跟进...
                    </a-button>
                  </div>
                </template>

                <template v-if="text">
                  <span
                    v-for="(item, index) in record.shadowList.slice(0, 2)"
                    :key="index"
                  >
                    {{ item.takes }} {{ item.createTime }} <br />
                  </span>
                </template>
                <span v-else>
                  {{ "" }}
                </span>
              </a-popover>
            </span>

            <span slot="slotRemark" slot-scope="{ text }">
              <a-popover trigger="hover" placement="leftBottom">
                <template #content>
                  <div style="position: relative">
                    <span v-if="text"> {{ text }}</span>
                    <p v-else></p>
                  </div>
                </template>
                <span v-if="text"> {{ text }} </span>
                <span v-else> </span>
              </a-popover>
            </span>
          </advance-table>
        </a-tab-pane>

        <a-tab-pane key="zhuangku" tab="潜在客户" v-if="isShow">
          <advance-table
            title=" "
            :pagination="{
              current: queryParam.pageNum,
              pageSize: queryParam.pageSize,
              total: total,
              showSizeChanger: true,
              showLessItems: true,
              showQuickJumper: true,
              showTotal: (total, range) =>
                `第 ${range[0]}-${range[1]} 条，总计 ${total} 条`,
              onChange: changeSize,
              onShowSizeChange: onShowSizeChange,
              pageSizeOptions: pageSizeOptions,
            }"
            tableKey="base-bizCustomer-index-table-alllist_zk"
            rowKey="zkId"
            size="middle"
            @refresh="getList"
            @change="handleTableChange"
            :columns="zhuangkuColumns"
            :data-source="bizCustomerZkList"
            :loading="loading"
            :format-conditions="true"
            :row-selection="{
              selectedRowKeys: selectedRowKeys,
              onChange: onSelectChange,
            }"
            :scroll="{ x: '100%' }"
          >
            <div class="table-operations" slot="button">
              <a-button @click="handleZhuaMyCus('-1')" class="xiansuochi">
                <a-icon type="retweet" />转入线索池
              </a-button>
              <a-button @click="handleShare" class="zhuanggeitaren">
                <a-icon type="share-alt" />转给他人
              </a-button>
              <a-button @click="handleXiezhu" class="xiezhu">
                <a-icon type="user-add" />请求协助
              </a-button>
            </div>

            <span slot="status" slot-scope="{ text, record }">
              <a-tag v-if="text == '0'" color="#2db7f5">{{
                statusFormat(record)
              }}</a-tag>
              <a-tag v-if="text == '1'" color="#87d068">{{
                statusFormat(record)
              }}</a-tag>
              <a-tag
                v-if="text == '-99' || text == '-88'"
                @click="handleShare(record)"
                color="#f50"
                >{{ statusFormat(record) }}</a-tag
              >
            </span>

            <span slot="cusName" slot-scope="{ text, record }">
              <a-tooltip :title="ownTpyeRemarkFormat(record)">
                <a-tag color="red">{{ ownTpyeFormat(record) }}</a-tag>
              </a-tooltip>
              <a @click="handleShadow(record)" style="color: #f56c6c">
                {{ text }}
              </a>

              <a-popover
                title="推送记录"
                trigger="hover"
                placement="rightBottom"
              >
                <template #content>
                  <template v-if="record.pushList">
                    <p v-for="(item, index) in record.pushList" :key="index">
                      {{ item.laiyuan }} {{ item.createTime }}
                    </p>
                  </template>
                  <p v-else>{{ "" }}</p>
                </template>
                <template
                  v-if="
                    record.pushList &&
                    record.pushList.filter((item) => item.isRep === 1).length >
                      0
                  "
                >
                  <a-badge
                    :count="record.pushList.length"
                    :number-style="{
                      backgroundColor: '#fff',
                      color: '#999',
                      boxShadow: '0 0 0 1px #d9d9d9 inset',
                      fontSize: '10px', // 减小字体大小
                    }"
                  >
                  </a-badge>
                </template>
              </a-popover>
              <a-icon
                type="star"
                v-if="record.isHeart == 2"
                theme="filled"
                style="color: #f50; font-size: 14px; margin-left: 5px"
                @click="handleHeartCancel(record)"
              ></a-icon>
              <a-icon
                type="star"
                v-else
                style="
                  color: rgb(243 125 66);
                  font-size: 14px;
                  margin-left: 5px;
                "
                @click="handleHeart(record)"
              ></a-icon>

              <!-- <a-icon
            type="lock"
            v-if="record.isLock == 1"
            theme="filled"
            style="color: #f50; font-size: 14px; margin-left: 5px"
            @click="handleLockCancel(record)"
          ></a-icon>
          <a-icon
            type="unlock"
            v-else
            style="color: rgb(243 125 66); font-size: 14px; margin-left: 5px"
            @click="handleLock(record)"
          ></a-icon> -->
            </span>
            <span slot="phone" slot-scope="{ text, record }">
              <a-icon
                type="phone"
                theme="filled"
                style="color: #269f70"
                :rotate="rotate"
                @click="handcallPhone(record)"
              />
              <a
                @click="handleShadow(record)"
                v-if="text"
                style="color: #f56c6c"
              >
                {{ "*******" + text.substring(7, 11) }}
              </a>
              <!-- {{ text }} -->
            </span>
            <span slot="rowindex" slot-scope="{ index }">
              {{ index + 1 }}
            </span>
            <span slot="type" slot-scope="{ record }">
              {{ typeFormat(record) }}
            </span>
            <span slot="level" slot-scope="{ record }">
              <a-rate v-model="record.level" @change="handleClueRate(record)" />
            </span>
            <span slot="progress" slot-scope="{ text, record }">
              <!-- <a-tag>
            {{ text ? busProgressFormat(record) : "状态待更新" }}
          </a-tag> -->
              <a-select
                v-model="record.progress"
                style="width: 100%"
                allow-clear
                @change="updateInfo(record)"
              >
                <a-select-option
                  v-for="(d, index) in progressOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </span>
            <span slot="pgPrice" slot-scope="{ text, record }">
              <a-input-number
                v-model="record.pgPrice"
                :min="0"
                :max="100"
                placeholder="最小值"
                :formatter="(value) => `${value}万`"
                :parser="(value) => value.replace('万', '')"
                :precision="2"
                allow-clear
                @blur="updateInfo(record)"
              />
            </span>
            <span slot="carStatus" slot-scope="{ text, record }">
              <a-select
                v-model="record.carStatus"
                style="width: 100%"
                allow-clear
                @change="updateInfo(record)"
              >
                <a-select-option
                  v-for="(d, index) in carStatusOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </span>
            <span slot="isDail" slot-scope="{ text }">
              <a-tag v-if="text == '0'" color="#2db7f5"> 待拨打</a-tag>
              <a-tag v-if="text == '1'" color="#87d068"> 已拨打</a-tag>
            </span>
            <span slot="businessStatus" slot-scope="{ record }">
              <a-tag color="#2db7f5"> {{ businessStatusFormat(record) }}</a-tag>
            </span>
            <span slot="amount" slot-scope="{ text }">
              ¥ {{ parseFloat(text || 0).toFixed(2) }}
            </span>
            <span slot="isLock" slot-scope="{ text, record }">
              <a-popconfirm
                ok-text="是"
                cancel-text="否"
                @confirm="confirmHandleStatus(record)"
                @cancel="cancelHandleStatus(record)"
              >
                <span slot="title"
                  >确认<b>{{ record.isLock == "0" ? "锁定" : "解锁" }}</b
                  >{{ record.cusName }}吗?</span
                >
                <a-switch
                  checked-children="锁"
                  un-checked-children="未锁"
                  :checked="record.isLock == 1"
                />
              </a-popconfirm>
            </span>

            <span slot="contactStatus" slot-scope="{ text, record }">
              <span v-if="record.shadowList && record.shadowList.length > 0">
                {{
                  record.shadowList[0].phoneStatus
                    ? record.shadowList[0].phoneStatus
                    : ""
                }}
                {{
                  record.shadowList[0].phoneStatus &&
                  record.shadowList[0].vxStatus
                    ? "-"
                    : ""
                }}
                {{
                  record.shadowList[0].vxStatus
                    ? record.shadowList[0].vxStatus
                    : ""
                }}</span
              >
              <p v-else>{{ "" }}</p>
            </span>
            <span slot="genjinInfo" slot-scope="{ text, record }">
              <a-popover
                title="跟进记录"
                trigger="hover"
                placement="top"
                :visible="record.ispop"
                @visibleChange="(v) => handleClickChange(v, record)"
              >
                <template #content>
                  <div style="position: relative">
                    <template v-if="text">
                      <a-timeline>
                        <a-timeline-item
                          v-for="(item, index) in record.shadowList"
                          :key="index"
                          :color="item.color"
                        >
                          {{ item.takes }} {{ item.createTime }}
                        </a-timeline-item>
                      </a-timeline>
                    </template>
                    <p v-else>{{ "" }}</p>
                    <a-button
                      type="link"
                      style="position: absolute; right: 0; bottom: 0"
                      @click="genjinClick(record)"
                    >
                      更多跟进...
                    </a-button>
                  </div>
                </template>

                <template v-if="text">
                  <span
                    v-for="(item, index) in record.shadowList.slice(0, 2)"
                    :key="index"
                  >
                    {{ item.takes }} {{ item.createTime }} <br />
                  </span>
                </template>
                <span v-else>
                  {{ "" }}
                </span>
              </a-popover>
            </span>

            <span slot="slotRemark" slot-scope="{ text }">
              <a-popover trigger="hover" placement="leftBottom">
                <template #content>
                  <div style="position: relative">
                    <span v-if="text"> {{ text }}</span>
                    <p v-else>{{ "" }}</p>
                  </div>
                </template>
                <span v-if="text"> {{ text }} </span>
                <span v-else>
                  {{ "" }}
                </span>
              </a-popover>
            </span>
          </advance-table></a-tab-pane
        >
      </a-tabs>
      <advance-table
        v-if="tabkey !== 'receive' && tabkey !== 'zhuangku'"
        title="客户信息"
        :pagination="{
          current: queryParam.pageNum,
          pageSize: queryParam.pageSize,
          total: total,
          showSizeChanger: true,
          showLessItems: true,
          showQuickJumper: true,
          showTotal: (total, range) =>
            `第 ${range[0]}-${range[1]} 条，总计 ${total} 条`,
          onChange: changeSize,
          onShowSizeChange: onShowSizeChange,
          pageSizeOptions: pageSizeOptions,
        }"
        tableKey="base-bizCustomer-index-table-myindex-zhuangku"
        rowKey="id"
        size="middle"
        @refresh="getList"
        @change="handleTableChange"
        :columns="customerColumns"
        :data-source="bizCustomerList"
        :loading="loading"
        :format-conditions="true"
        :row-selection="{
          selectedRowKeys: selectedRowKeys,
          onChange: onSelectChange,
        }"
        :scroll="{ x: '100%' }"
      >
        <div class="table-operations" slot="button">
          <a-button @click="handleAddYuShen()" class="addJinjian">
            <a-icon type="solution" />预审申请
          </a-button>
          <a-button @click="handleZhuaMyCus('7')" class="togonghai">
            <a-icon type="rollback" />转入公海
          </a-button>
          <a-button @click="handleZhuaMyCus('-1')" class="xiansuochi">
            <a-icon type="retweet" />转入线索池
          </a-button>
          <a-button @click="handleShare" class="zhuanggeitaren">
            <a-icon type="share-alt" />转给他人
          </a-button>
          <a-button @click="handleXiezhu" class="xiezhu">
            <a-icon type="user-add" />请求协助
          </a-button>
          <a-button type="primary" @click="handleAdd()">
            <a-icon type="plus" />新增客户
          </a-button>
          <a-button class="importcustomer" @click="handleAddImportData()">
            <a-icon type="upload" />导入客户
          </a-button>
          <a-button @click="handleExport">
            <a-icon type="cloud-download" />导出客户
          </a-button>
          <a-button class="heimingdan" @click="handleToHeimingdan()">
            <a-icon type="delete" />黑名单
          </a-button>
        </div>

        <span slot="status" slot-scope="{ text, record }">
          <a-tag v-if="text == '0'" color="#2db7f5">{{
            statusFormat(record)
          }}</a-tag>
          <a-tag v-if="text == '1'" color="#87d068">{{
            statusFormat(record)
          }}</a-tag>
          <a-tag
            v-if="text == '-99' || text == '-88'"
            @click="handleShare(record)"
            color="#f50"
            >{{ statusFormat(record) }}</a-tag
          >
        </span>

        <span slot="cusName" slot-scope="{ text, record }">
          <a-tooltip :title="ownTpyeRemarkFormat(record)">
            <a-tag color="red">{{ ownTpyeFormat(record) }}</a-tag>
          </a-tooltip>
          <a @click="handleShadow(record)" style="color: #f56c6c">
            {{ text }}
          </a>

          <a-popover title="推送记录" trigger="hover" placement="rightBottom">
            <template #content>
              <template v-if="record.pushList">
                <p v-for="(item, index) in record.pushList" :key="index">
                  {{ item.laiyuan }} {{ item.createTime }}
                </p>
              </template>
              <p v-else>{{ "" }}</p>
            </template>
            <template
              v-if="
                record.pushList &&
                record.pushList.filter((item) => item.isRep === 1).length > 0
              "
            >
              <a-badge
                :count="record.pushList.length"
                :number-style="{
                  backgroundColor: '#fff',
                  color: '#999',
                  boxShadow: '0 0 0 1px #d9d9d9 inset',
                  fontSize: '10px', // 减小字体大小
                }"
              >
              </a-badge>
            </template>
          </a-popover>
          <a-icon
            type="star"
            v-if="record.isHeart == 2"
            theme="filled"
            style="color: #f50; font-size: 14px; margin-left: 5px"
            @click="handleHeartCancel(record)"
          ></a-icon>
          <a-icon
            type="star"
            v-else
            style="color: rgb(243 125 66); font-size: 14px; margin-left: 5px"
            @click="handleHeart(record)"
          ></a-icon>

          <!-- <a-icon
            type="lock"
            v-if="record.isLock == 1"
            theme="filled"
            style="color: #f50; font-size: 14px; margin-left: 5px"
            @click="handleLockCancel(record)"
          ></a-icon>
          <a-icon
            type="unlock"
            v-else
            style="color: rgb(243 125 66); font-size: 14px; margin-left: 5px"
            @click="handleLock(record)"
          ></a-icon> -->
        </span>
        <span slot="phone" slot-scope="{ text, record }">
          <a-icon
            type="phone"
            theme="filled"
            style="color: #269f70"
            :rotate="rotate"
            @click="handcallPhone(record)"
          />
          <a @click="handleShadow(record)" v-if="text" style="color: #f56c6c">
            {{ "*******" + text.substring(7, 11) }}
          </a>
          <!-- {{ text }} -->
        </span>
        <span slot="rowindex" slot-scope="{ index }">
          {{ index + 1 }}
        </span>
        <span slot="type" slot-scope="{ record }">
          {{ typeFormat(record) }}
        </span>
        <span slot="level" slot-scope="{ record }">
          <a-rate v-model="record.level" @change="handleClueRate(record)" />
        </span>
        <span slot="progress" slot-scope="{ text, record }">
          <!-- <a-tag>
            {{ text ? busProgressFormat(record) : "状态待更新" }}
          </a-tag> -->
          <a-select
            v-model="record.progress"
            style="width: 100%"
            allow-clear
            @change="updateInfo(record)"
          >
            <a-select-option
              v-for="(d, index) in progressOptions"
              :key="index"
              :value="d.dictValue"
              >{{ d.dictLabel }}</a-select-option
            >
          </a-select>
        </span>
        <span slot="pgPrice" slot-scope="{ text, record }">
          <a-input-number
            v-model="record.pgPrice"
            :min="0"
            :max="100"
            placeholder="最小值"
            :formatter="(value) => `${value}万`"
            :parser="(value) => value.replace('万', '')"
            :precision="2"
            allow-clear
            @blur="updateInfo(record)"
          />
        </span>
        <span slot="carStatus" slot-scope="{ text, record }">
          <a-select
            v-model="record.carStatus"
            style="width: 100%"
            allow-clear
            @change="updateInfo(record)"
          >
            <a-select-option
              v-for="(d, index) in carStatusOptions"
              :key="index"
              :value="d.dictValue"
              >{{ d.dictLabel }}</a-select-option
            >
          </a-select>
        </span>
        <span slot="isDail" slot-scope="{ text }">
          <a-tag v-if="text == '0'" color="#2db7f5"> 待拨打</a-tag>
          <a-tag v-if="text == '1'" color="#87d068"> 已拨打</a-tag>
        </span>
        <span slot="businessStatus" slot-scope="{ record }">
          <a-tag color="#2db7f5"> {{ businessStatusFormat(record) }}</a-tag>
        </span>
        <span slot="amount" slot-scope="{ text }">
          ¥ {{ parseFloat(text || 0).toFixed(2) }}
        </span>
        <span slot="isLock" slot-scope="{ text, record }">
          <a-popconfirm
            ok-text="是"
            cancel-text="否"
            @confirm="confirmHandleStatus(record)"
            @cancel="cancelHandleStatus(record)"
          >
            <span slot="title"
              >确认<b>{{ record.isLock == "0" ? "锁定" : "解锁" }}</b
              >{{ record.cusName }}吗?</span
            >
            <a-switch
              checked-children="锁"
              un-checked-children="未锁"
              :checked="record.isLock == 1"
            />
          </a-popconfirm>
        </span>

        <span slot="contactStatus" slot-scope="{ text, record }">
          <span v-if="record.shadowList && record.shadowList.length > 0">
            {{
              record.shadowList[0].phoneStatus
                ? record.shadowList[0].phoneStatus
                : ""
            }}
            {{
              record.shadowList[0].phoneStatus && record.shadowList[0].vxStatus
                ? "-"
                : ""
            }}
            {{
              record.shadowList[0].vxStatus ? record.shadowList[0].vxStatus : ""
            }}</span
          >
          <p v-else>{{ "" }}</p>
        </span>
        <span slot="genjinInfo" slot-scope="{ text, record }">
          <a-popover
            title="跟进记录"
            trigger="hover"
            placement="top"
            :visible="record.ispop"
            @visibleChange="(v) => handleClickChange(v, record)"
          >
            <template #content>
              <div style="position: relative">
                <template v-if="text">
                  <a-timeline>
                    <a-timeline-item
                      v-for="(item, index) in record.shadowList"
                      :key="index"
                      :color="item.color"
                    >
                      {{ item.takes }} {{ item.createTime }}
                    </a-timeline-item>
                  </a-timeline>
                </template>
                <p v-else>{{ "" }}</p>
                <a-button
                  type="link"
                  style="position: absolute; right: 0; bottom: 0"
                  @click="genjinClick(record)"
                >
                  更多跟进...
                </a-button>
              </div>
            </template>

            <template v-if="text">
              <span
                v-for="(item, index) in record.shadowList.slice(0, 2)"
                :key="index"
              >
                {{ item.takes }} {{ item.createTime }} <br />
              </span>
            </template>
            <span v-else>
              {{ "" }}
            </span>
          </a-popover>
        </span>

        <span slot="slotRemark" slot-scope="{ text }">
          <a-popover trigger="hover" placement="leftBottom">
            <template #content>
              <div style="position: relative">
                <span v-if="text"> {{ text }}</span>
                <p v-else>{{ "" }}</p>
              </div>
            </template>
            <span v-if="text"> {{ text }} </span>
            <span v-else>
              {{ "" }}
            </span>
          </a-popover>
        </span>
      </advance-table>
    </a-card>
    <a-modal
      :visible="visible"
      title="选择转移到员工"
      v-if="visible"
      width="65%"
      @ok="handleOk"
      @cancel="handleCancel"
      :dialog-style="{ top: '10px' }"
      style="height: 60vh"
      :confirm-loading="confirmLoading"
    >
      <change-user
        @getUser="handleManualShare"
        :isKefu="isKefu"
        :isCheckBox="true"
      />
    </a-modal>

    <a-modal
      :visible="xiezhuVisible"
      title="选择协助员工"
      v-if="xiezhuVisible"
      width="65%"
      @ok="handleXiezhuOk"
      @cancel="handleXiezhuCancel"
      :dialog-style="{ top: '10px' }"
      style="height: 60vh"
      :confirm-loading="confirmLoading"
    >
      <change-user
        @getUser="handleManualXiezhu"
        :isCheckBox="true"
        :isKefu="isKefu"
        :postIds="postIds"
      />
    </a-modal>

    <a-modal
      :visible="showYuShenRes"
      title="预审结果"
      v-if="showYuShenRes"
      width="350px"
      @ok="handleShowResOK"
      @cancel="handleShowResOK"
    >
      <a-row>
        <a-col :span="24" style="text-align: center; background-color: #004ca7">
          <div
            style="
              color: #fff;
              font-size: 18px;
              height: 42px;
              line-height: 42px;
            "
          >
            预审结果
          </div>
        </a-col>
        <a-col :span="20" style="text-align: center; margin-top: 10px">
          <div style="color: #f56c6c; font-size: 18px">
            <a-icon
              type="check-circle"
              style="color: #f56c6c; font-size: 18px; margin-right: 10px"
            />恭喜您，预审通过！
          </div>
        </a-col>
      </a-row>
      <a-row>
        <a-col :span="20" style="margin-left: 10%; margin-top: 20px">
          <a-descriptions title="" :column="1">
            <a-descriptions-item label="预审编号">
              {{ yushenInfo.id }}
            </a-descriptions-item>
            <a-descriptions-item label="姓名">
              {{ yushenInfo.cusName }}
            </a-descriptions-item>
            <a-descriptions-item label="联系电话">
              {{ yushenInfo.phone }}
            </a-descriptions-item>
            <a-descriptions-item label="预审金额">
              <span> {{ moneyFormat(yushenInfo.amount) }}</span> (元)
            </a-descriptions-item>
            <a-descriptions-item label="预审状态">
              <span style="color: #f56c6c">预审通过</span>
            </a-descriptions-item>
            <a-descriptions-item label="申请时间">
              {{ yushenInfo.createTime.substring(0, 11) }}
            </a-descriptions-item>
          </a-descriptions>
          <a-descriptions title="" :column="1" layout="vertical">
            <a-descriptions-item label="温馨提示" span="2">
              {{ yushenInfo.remark }}
            </a-descriptions-item>
          </a-descriptions>
        </a-col>
      </a-row>
    </a-modal>
  </div>
</template>
<script>
import {
  listBizMyListCustomer,
  delBizCustomer,
  exportBizCustomer,
  manualShareBatch,
  updateStatus,
  updateBizCustomer,
  lockCustomer,
  playCall,
  customerClueRate,
  updateHeart,
  findMyReceiveList,
  findZhuangKuList,
} from "@/api/biz/bizCustomer";
import AdvanceTable from "@/components/pt/table/AdvanceTable";
import BizCustomerAddForm from "@/views/biz/customer/modules/BizCustomerAddForm";
import BizCustomerEditForm from "@/views/biz/customer/modules/BizCustomerEditForm";
import BizCustomerInfoShadowForm from "@/views/biz/customer/modules/BizCustomerInfoShadowForm";
import ChangeUser from "@/views/system/user/modules/ChangeUser";
import BizYushenInfoAddForm from "@/views/biz/yusheninfo/modules/BizYushenInfoAddForm";
import BizCustomerAddInfoForm from "@/views/biz/customer/modules/BizCustomerAddInfoForm";
import { findListByCode } from "@/api/biz/sysArea";
import { multiAddBizCustomerXiezu } from "@/api/biz/bizCustomerXiezu";
import ChoseModal from "@/views/biz/customer/modules/components/ChoseModal";
import ToHeimingdanModal from "@/views/biz/customer/modules/components/ToHeimingdanModal";
import { listUser } from "@/api/system/user";
import { listDeptTree } from "@/api/system/dept";
export default {
  name: "BizCustomer",
  components: {
    AdvanceTable,
    BizCustomerAddForm,
    BizCustomerEditForm,
    BizCustomerInfoShadowForm,
    ChangeUser,
    BizYushenInfoAddForm,
    BizCustomerAddInfoForm,
    ChoseModal,
    ToHeimingdanModal,
  },
  data() {
    return {
      // 潜在客户数据源
      bizCustomerZkList: [],
      isShow: false,
      toHeimingdanReasonOptions: [],
      showToHeiReasonModal: false,
      showTypeModal: false,
      visible: false,
      showAddModal: false,
      showEditModal: false,
      showShadowModal: false,
      showAddInfoModal: false,
      showAddImportModal: false,
      confirmLoading: false,
      choseOptions: [
        { value: -1, label: "线索池" },
        { value: 0, label: "我的客户" },
      ],
      rotate: 90,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 选中的主键集合
      selectedRowKeys: [],
      // 选中的数据集合
      selectedRows: [],
      // 高级搜索 展开/关闭
      advanced: false,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // label的百分比
      labelCol: { span: 6 },
      // 内容区域的百分比
      wrapperCol: { span: 18 },
      // 左心房客户推送信息表格数据
      bizCustomerList: [],
      // 我的接单数据源
      bizCustomerReceiveList: [],
      // 状态字典
      statusOptions: [],
      // 申请类型字典
      typeOptions: [],
      // 业务进度
      progressOptions: [],
      levelOptions: [],
      ideasTypeOptions: [],
      // 征信信息
      zxInfoOptions: [],
      zhichanInfoOptions: [],
      genjinQuckitInputOptions: [],
      ownTypeOptions: [],
      fujianTypeOptions: [],
      businessStatusOptions: [],
      carStatusOptions: [],
      // 性别
      sexOptions: [],
      // 当前分页数据的ID数组
      cusListIds: [],
      laiyuanOptions: [],
      // 预审结果
      yushenInfo: {},
      showYuShenRes: false,
      // 查询参数
      queryParam: {
        pageNum: 1,
        pageSize: 10,
        status: "0",
        // orderByColumn: "createTime",
        // isAsc: "desc",
      },
      pageSizeOptions: ["10", "20", "30", "40", "100", "200", "300", "400"],
      // customerInfo
      customerInfo: {},
      // 时间
      dateRange: [],
      dateRangeEndTime: [],
      // 车辆类型
      carTypeOptions: [],
      // 城市列表
      cityOptions: [],
      xiezhuVisible: false,
      xiezhuForm: { xiezuUsers: [], customerIds: [], xiezuUserNames: [] },
      tabkey: "all",
      // 根据岗位删选员工
      postIds: ["gwzg", "rzgw", "qyjl", "sg"],
      // 部门信息
      deptOptions: [],
      userNamesList: [],
      isKefu: 2,
      customerColumns: [
        {
          title: "序号",
          dataIndex: "rowindex",
          ellipsis: true,
          align: "center",
          width: "50px",
          scopedSlots: { customRender: "rowindex" },
        },

        {
          title: "首次进线",
          dataIndex: "createTime",
          align: "center",
          width: "150px",
          sorter: true,
        },
        {
          title: "最后进线",
          dataIndex: "receiveTime",
          align: "center",
          width: "150px",
        },
        {
          title: "客户姓名",
          dataIndex: "cusName",
          ellipsis: true,
          align: "left",
          width: "140px",
          scopedSlots: { customRender: "cusName" },
        },
        {
          title: "电话",
          dataIndex: "phone",
          ellipsis: true,
          align: "center",
          width: "120px",
          // fixed: "left",
          scopedSlots: { customRender: "phone" },
        },

        {
          title: "客户来源",
          dataIndex: "laiyuan",
          ellipsis: true,
          align: "center",
          width: "80px",
        },
        {
          title: "车辆状态",
          dataIndex: "carStatus",
          align: "center",
          width: "110px",
          ellipsis: true,
          scopedSlots: { customRender: "carStatus" },
        },
        {
          title: "评估价格",
          dataIndex: "pgPrice",
          align: "center",
          width: "100px",
          ellipsis: true,
          scopedSlots: { customRender: "pgPrice" },
        },

        {
          title: "跟进状态",
          dataIndex: "progress",
          align: "center",
          width: "110px",
          ellipsis: true,
          scopedSlots: { customRender: "progress" },
        },

        {
          title: "联系状态",
          // dataIndex: "contactStatus",
          align: "center",
          width: "140px",
          ellipsis: true,
          scopedSlots: { customRender: "contactStatus" },
        },

        {
          title: "跟进记录",
          dataIndex: "shadowList",
          ellipsis: true,
          align: "left",
          width: "250px",
          scopedSlots: { customRender: "genjinInfo" },
        },
        {
          title: "星级",
          dataIndex: "level",
          align: "center",
          width: "190px",
          scopedSlots: { customRender: "level" },
          sorter: true,
        },
        {
          title: "最后跟进时间",
          dataIndex: "endTime",
          align: "center",
          width: "150px",
          sorter: true,
        },
        {
          title: "申请金额",
          dataIndex: "amount",
          align: "center",
          width: "80px",
          // scopedSlots: { customRender: "amount" },
        },
        {
          title: "车辆品牌",
          dataIndex: "carModel",
          ellipsis: true,
          align: "center",
          width: "80px",
        },
        {
          title: "车牌号",
          dataIndex: "carNo",
          ellipsis: true,
          align: "center",
          width: "80px",
        },
        {
          title: "是否拨打",
          dataIndex: "isDail",
          align: "center",
          width: "80px",
          scopedSlots: { customRender: "isDail" },
        },
        {
          title: "拨打时间",
          dataIndex: "dailTime",
          align: "center",
          width: "120px",
        },
        {
          title: "备注",
          dataIndex: "remark",
          ellipsis: true,
          align: "center",
          width: "150px",
          scopedSlots: { customRender: "slotRemark" },
        },
      ],
      // 我的接单列
      receiveColumns: [
        {
          title: "序号",
          dataIndex: "rowindex",
          ellipsis: true,
          align: "center",
          width: "50px",
          scopedSlots: { customRender: "rowindex" },
        },
        {
          title: "最后进线",
          dataIndex: "receiveTime",
          align: "center",
          width: "150px",
        },

        {
          title: "客户姓名",
          dataIndex: "cusName",
          ellipsis: true,
          align: "left",
          width: "140px",
          scopedSlots: { customRender: "cusName" },
        },
        {
          title: "电话",
          dataIndex: "phone",
          ellipsis: true,
          align: "center",
          width: "120px",
          // fixed: "left",
          scopedSlots: { customRender: "phone" },
        },

        {
          title: "客户来源",
          dataIndex: "receive_laiyuan",
          ellipsis: true,
          align: "center",
          width: "80px",
        },
        {
          title: "车辆状态",
          dataIndex: "carStatus",
          align: "center",
          width: "110px",
          ellipsis: true,
          scopedSlots: { customRender: "carStatus" },
        },
        {
          title: "评估价格",
          dataIndex: "pgPrice",
          align: "center",
          width: "100px",
          ellipsis: true,
          scopedSlots: { customRender: "pgPrice" },
        },
        {
          title: "接单经理",
          dataIndex: "receive_userName",
          ellipsis: true,
          align: "center",
          width: "100px",
        },

        {
          title: "客户经理",
          dataIndex: "userName",
          ellipsis: true,
          align: "center",
          width: "100px",
          scopedSlots: { customRender: "userName" },
        },

        {
          title: "联系状态",
          // dataIndex: "contactStatus",
          align: "center",
          width: "140px",
          ellipsis: true,
          scopedSlots: { customRender: "contactStatus" },
        },

        {
          title: "跟进记录",
          dataIndex: "shadowList",
          ellipsis: true,
          align: "left",
          width: "250px",
          scopedSlots: { customRender: "genjinInfo" },
        },
        {
          title: "星级",
          dataIndex: "level",
          align: "center",
          width: "190px",
          sorter: true,
          scopedSlots: { customRender: "level" },
        },
        {
          title: "最后跟进时间",
          dataIndex: "endTime",
          align: "center",
          width: "150px",
          sorter: true,
        },
        {
          title: "申请金额",
          dataIndex: "amount",
          align: "center",
          width: "80px",
          // scopedSlots: { customRender: "amount" },
        },
        {
          title: "车辆品牌",
          dataIndex: "carModel",
          ellipsis: true,
          align: "center",
          width: "80px",
        },
        {
          title: "车牌号",
          dataIndex: "carNo",
          ellipsis: true,
          align: "center",
          width: "80px",
        },
        {
          title: "是否拨打",
          dataIndex: "isDail",
          align: "center",
          width: "80px",
          scopedSlots: { customRender: "isDail" },
        },
        {
          title: "拨打时间",
          dataIndex: "dailTime",
          align: "center",
          width: "120px",
        },
        {
          title: "跟进状态",
          dataIndex: "progress",
          align: "center",
          width: "110px",
          ellipsis: true,
          scopedSlots: { customRender: "progress" },
        },
        {
          title: "备注",
          dataIndex: "remark",
          ellipsis: true,
          align: "center",
          width: "150px",
          scopedSlots: { customRender: "slotRemark" },
        },
      ],
      // 潜在客户列
      zhuangkuColumns: [
        {
          title: "序号",
          dataIndex: "rowindex",
          ellipsis: true,
          align: "center",
          width: "50px",
          scopedSlots: { customRender: "rowindex" },
        },

        {
          title: "首次进线",
          dataIndex: "createTime",
          align: "center",
          width: "150px",
          sorter: true,
        },
        {
          title: "最新进线",
          dataIndex: "zk_CreateTime",
          align: "center",
          width: "150px",
          sorter: true,
        },
        {
          title: "客户姓名",
          dataIndex: "cusName",
          ellipsis: true,
          align: "left",
          width: "140px",
          scopedSlots: { customRender: "cusName" },
        },
        {
          title: "电话",
          dataIndex: "phone",
          ellipsis: true,
          align: "center",
          width: "120px",
          // fixed: "left",
          scopedSlots: { customRender: "phone" },
        },

        {
          title: "客户来源",
          dataIndex: "laiyuan",
          ellipsis: true,
          align: "center",
          width: "80px",
        },
        {
          title: "车辆状态",
          dataIndex: "carStatus",
          align: "center",
          width: "110px",
          ellipsis: true,
          scopedSlots: { customRender: "carStatus" },
        },
        {
          title: "评估价格",
          dataIndex: "pgPrice",
          align: "center",
          width: "100px",
          ellipsis: true,
          scopedSlots: { customRender: "pgPrice" },
        },

        {
          title: "跟进状态",
          dataIndex: "progress",
          align: "center",
          width: "110px",
          ellipsis: true,
          scopedSlots: { customRender: "progress" },
        },

        {
          title: "联系状态",
          // dataIndex: "contactStatus",
          align: "center",
          width: "140px",
          ellipsis: true,
          scopedSlots: { customRender: "contactStatus" },
        },

        {
          title: "跟进记录",
          dataIndex: "shadowList",
          ellipsis: true,
          align: "left",
          width: "250px",
          scopedSlots: { customRender: "genjinInfo" },
        },
        {
          title: "星级",
          dataIndex: "level",
          align: "center",
          width: "190px",
          sorter: true,
          scopedSlots: { customRender: "level" },
        },
        {
          title: "最后跟进时间",
          dataIndex: "endTime",
          align: "center",
          width: "150px",
          sorter: true,
        },
        {
          title: "申请金额",
          dataIndex: "amount",
          align: "center",
          width: "80px",
          // scopedSlots: { customRender: "amount" },
        },
        {
          title: "车辆品牌",
          dataIndex: "carModel",
          ellipsis: true,
          align: "center",
          width: "80px",
        },
        {
          title: "车牌号",
          dataIndex: "carNo",
          ellipsis: true,
          align: "center",
          width: "80px",
        },
        {
          title: "是否拨打",
          dataIndex: "isDail",
          align: "center",
          width: "80px",
          scopedSlots: { customRender: "isDail" },
        },
        {
          title: "拨打时间",
          dataIndex: "dailTime",
          align: "center",
          width: "120px",
        },
        {
          title: "备注",
          dataIndex: "remark",
          ellipsis: true,
          align: "center",
          width: "150px",
          scopedSlots: { customRender: "slotRemark" },
        },
      ],
    };
  },

  watch: {
    "$route.query": {
      handler(newQuery, oldQuery) {
        // 只有 query 变化时才触发
        if (newQuery._t !== oldQuery._t) {
          // 重新加载数据
          this.toPageAddParam();
          this.handleQuery();
        }
      },
      deep: true,
    },
  },

  created() {
    this.toPageAddParam();
    this.getList();
    this.getDicts("customer_bus_status").then((response) => {
      this.businessStatusOptions = response.data;
    });
    this.getDicts("customer_status").then((response) => {
      this.statusOptions = response.data;
    });
    this.getDicts("customer_type").then((response) => {
      this.typeOptions = response.data;
    });
    this.getDicts("bus_progress").then((response) => {
      this.progressOptions = response.data;
    });
    this.getDicts("level_options").then((response) => {
      this.levelOptions = response.data;
    });
    this.getDicts("ideas_type_options").then((response) => {
      this.ideasTypeOptions = response.data;
    });
    this.getDicts("zx_info").then((response) => {
      this.zxInfoOptions = response.data;
    });
    this.getDicts("sys_user_sex").then((response) => {
      this.sexOptions = response.data;
    });
    this.getDicts("zhichan_info").then((response) => {
      this.zhichanInfoOptions = response.data;
    });
    this.getDicts("genjin_quckit_input").then((response) => {
      this.genjinQuckitInputOptions = response.data;
    });
    this.getDicts("own_type").then((response) => {
      this.ownTypeOptions = response.data;
    });
    this.getDicts("fujian_type").then((response) => {
      this.fujianTypeOptions = response.data;
    });
    this.getDicts("car_status_options").then((response) => {
      this.carStatusOptions = response.data;
    });
    this.getDicts("car_type").then((response) => {
      this.carTypeOptions = response.data;
    });
    this.getDicts("to_heimingdan_reason_options").then((response) => {
      this.toHeimingdanReasonOptions = response.data;
    });

    this.handleFindCityList();
    this.getDeptList();

    // 控制潜在客户标签页是否显示 "*:*:*"是管理员
    if (
      this.permissions.includes("*:*:*") ||
      this.permissions.includes("biz:customer:zhuangku:leader")
    ) {
      this.isShow = true;
    } else {
      this.isShow = false;
    }
  },
  methods: {
    toHeiReasonModalOk(reason) {
      var that = this;
      return updateStatus({
        ids: that.ids,
        status: "-3",
        toHeimingdanReason: reason,
      }).then((res) => {
        that.showToHeiReasonModal = false;
        that.getList();
        that.$message.success("操作成功", 3);
      });
    },
    handleToHeimingdan() {
      var that = this;
      if (that.ids.length === 0) {
        that.$message.warning("请选择客户", 3);
        return;
      }
      this.$confirm({
        title: "确认要执行该操作?",
        onOk() {
          // 弹窗填写拉黑理由
          that.showToHeiReasonModal = true;
          that.$nextTick(() => that.$refs.toHeiReasonModal.showModal());
        },
        onCancel() {},
      });
    },

    handleLock(record) {
      record.isLock = 1;
      var form = { id: record.id, isLock: record.isLock };
      lockCustomer(form).then((response) => {
        this.$message.success("锁定成功");
      });
    },
    handleLockCancel(record) {
      record.isLock = 0;
      var form = { id: record.id, isLock: record.isLock };
      lockCustomer(form).then((response) => {
        this.$message.success("解锁成功");
      });
    },

    getUserList(deptId) {
      const params = {
        pageNum: 1,
        pageSize: 100,
        deptId: deptId,
      };
      if (this.isKefu) {
        params.isKefu = this.isKefu;
      }
      if (this.postIds) {
        params.postIds = this.postIds;
      }
      listUser(params).then((res) => {
        this.userNamesList = res.data.list;
      });
    },
    onMenuTreeChange(value) {
      this.getUserList(value);
    },
    getDeptList() {
      listDeptTree("", 3, 2).then((response) => {
        // this.expandTree(response.data, 3, this.expandedRowKeys);
        this.deptOptions = response.data;
      });
    },

    // 转给他人选择后事件
    typeModalOk(chose) {
      var that = this;
      this.visible = true;
      console.log("chose", chose);
      that.customerInfo.status = chose;
    },
    // 首页搜索跳转
    toPageAddParam() {
      if (this.$route.query.phone) {
        const phone = this.$route.query.phone;
        this.queryParam = {
          pageNum: 1,
          pageSize: 10,
          status: "0",
          phone: phone,
        };
        // 清除地址栏中的查询参数
        this.$router.replace({ query: null });
      }
    },

    handleClickChange(visible, item) {
      item.ispop = visible;
    },
    genjinClick(record) {
      record.ispop = false; // 关闭 popover
      this.handleShadow(record);
      this.$nextTick(() =>
        this.$refs.bizCustomerInfoShadowForm.handleSetDefaultTab("genjin")
      );
    },

    /** 分页、删选、排序 */
    handleTableChange(pagination, filters, sorter) {
      if (
        sorter.order !== undefined &&
        sorter.order !== null &&
        sorter.order !== ""
      ) {
        this.queryParam.orderByColumn = "a." + sorter.field;
        if (sorter.order === "ascend") {
          this.queryParam.isAsc = "asc";
        } else if (sorter.order === "descend") {
          this.queryParam.isAsc = "desc";
        }
      } else {
        this.queryParam.orderByColumn = null;
        this.queryParam.isAsc = null;
      }
      this.getList();
    },

    // 获取城市区域列表
    handleFindCityList() {
      findListByCode().then((res) => {
        this.cityOptions = res.data;
      });
    },
    /** tab选显卡操作 */
    callback(v) {
      this.tabkey = v;
      this.queryParam.createdWithinDays = undefined;
      this.queryParam.expiredWithinDays = undefined;
      this.queryParam.isLock = undefined;
      if (v === "all") {
        this.queryParam.createdWithinDays = undefined;
        this.queryParam.expiredWithinDays = undefined;
        this.queryParam.isLock = undefined;
      }
      if (v === "today") {
        this.queryParam.createdWithinDays = 0;
        this.queryParam.expiredWithinDays = undefined;
        this.queryParam.isLock = undefined;
      }
      if (v === "sanday") {
        this.queryParam.createdWithinDays = undefined;
        this.queryParam.expiredWithinDays = 3;
        this.queryParam.isLock = undefined;
      }
      if (v === "lock") {
        this.queryParam.createdWithinDays = undefined;
        this.queryParam.expiredWithinDays = undefined;
        this.queryParam.isLock = 1;
      }
      this.handleQuery();
    },

    onLaiyuanChange(v) {
      var type = "bus_type";
      if (v === "1") {
        type = "bus_type";
      } else {
        type = "laiyuan_self";
      }

      this.getDicts(type).then((response) => {
        this.laiyuanOptions = response.data;
      });
    },
    handleHeart(row) {
      row.isHeart = 2;
      updateHeart(row).then((response) => {
        this.$message.success("操作成功");
      });
    },
    handleHeartCancel(row) {
      row.isHeart = 1;
      updateHeart(row).then((response) => {
        this.$message.success("操作成功");
      });
    },
    moneyFormat(num, decimal = 2, split = ",") {
      /*
    parameter：
    num：格式化目标数字
    decimal：保留几位小数，默认2位
    split：千分位分隔符，默认为,
    moneyFormat(123456789.87654321, 2, ',') // 123,456,789.88
  */
      if (isFinite(num)) {
        // num是数字
        if (num === 0) {
          // 为0
          return num.toFixed(decimal);
        } else {
          // 非0
          var res = "";
          var dotIndex = String(num).indexOf(".");
          if (dotIndex === -1) {
            // 整数
            if (decimal === 0) {
              res = String(num).replace(/(\d)(?=(?:\d{3})+$)/g, `$1${split}`);
            } else {
              res =
                String(num).replace(/(\d)(?=(?:\d{3})+$)/g, `$1${split}`) +
                "." +
                "0".repeat(decimal);
            }
          } else {
            // 非整数
            // js四舍五入 Math.round()：正数时4舍5入，负数时5舍6入
            // Math.round(1.5) = 2
            // Math.round(-1.5) = -1
            // Math.round(-1.6) = -2
            // 保留decimals位小数
            const numStr = String(
              (
                Math.round(num * Math.pow(10, decimal)) / Math.pow(10, decimal)
              ).toFixed(decimal)
            ); // 四舍五入，然后固定保留2位小数
            const decimals = numStr.slice(dotIndex, dotIndex + decimal + 1); // 截取小数位
            res =
              String(numStr.slice(0, dotIndex)).replace(
                /(\d)(?=(?:\d{3})+$)/g,
                `$1${split}`
              ) + decimals;
          }
          return res;
        }
      } else {
        return "--";
      }
    },
    updateInfo(rows) {
      updateBizCustomer(rows).then((res) => {
        if (res.code === 200) {
          this.$message.success("操作成功", 3);
          this.getList();
        }
      });
    },
    handcallPhone(item) {
      playCall({ phone: item.phone, id: item.id }).then((res) => {
        if (res.code === 200) {
          this.$message.success(res.msg);
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    // 展示预审结果
    handleShowRes(item) {
      this.yushenInfo = item;

      this.showAddModal = false;
      this.showYuShenRes = true;
    },
    // 关闭
    handleShowCancel() {
      this.showAddModal = false;
    },
    handleShowResOK() {
      this.showYuShenRes = false;
    },
    // 添加预审信息
    handleAddYuShen() {
      if (this.selectedRows.length > 0) {
        this.showAddModal = true;
        this.$nextTick(() =>
          this.$refs.bizYushenInfoAddForm.handleAdd(this.selectedRows[0])
        );
      } else {
        this.$message.warning("请选择客户", 3);
      }
    },
    // 客户跟踪信息
    handleShadow(record) {
      this.showShadowModal = true;
      this.$nextTick(() =>
        this.$refs.bizCustomerInfoShadowForm.handleShadow(
          record,
          this.cusListIds
        )
      );
    },
    handleManualShare(user) {
      this.customerInfo.userId = user[0].id;
      this.customerInfo.userIds = user.map((item) => {
        return item.id;
      });
    },
    // 分享给别人
    handleShare() {
      var that = this;
      if (that.ids.length === 0) {
        that.$message.warning("请选择客户", 3);
        return;
      }
      this.showTypeModal = true;
      this.$nextTick(() => this.$refs.choseModal.showModal());

      // if (that.ids.length > 1) {
      //   that.$message.warning("只能选择一个客户进行转移", 3);
      //   return;
      // }
    },
    // 请求协助
    handleXiezhu() {
      var that = this;
      if (that.ids.length === 0) {
        that.$message.warning("请选择客户", 3);
        return;
      }
      that.xiezhuVisible = true;
      console.log("ids", that.ids);
      this.xiezhuForm.customerIds = that.ids;
    },
    // 确认协助
    handleXiezhuOk() {
      var that = this;
      this.confirmLoading = true;
      if (that.xiezhuForm.customerIds.length > 0) {
        multiAddBizCustomerXiezu(this.xiezhuForm).then((res) => {
          if (res.code === 200) {
            that.xiezhuVisible = false;
            that.onSelectChange([], []);
            this.getList();
            that.$message.success("协助成功！", 3);
          }
          this.confirmLoading = false;
        });
      } else {
        that.$message.warn("请选择员工！", 3);
        this.confirmLoading = false;
      }
    },
    handleXiezhuCancel() {
      this.xiezhuVisible = false;
    },

    // 用户选择事件
    handleManualXiezhu(user) {
      console.log("handleManualXiezhuUser", user);
      const xiezuUserList = user;
      this.xiezhuForm.xiezuUsers = xiezuUserList.map((item) => {
        return item.id;
      });
      this.xiezhuForm.xiezuUserNames = xiezuUserList.map((item) => {
        return item.name;
      });
    },

    getTeacher(item) {
      this.teacherId = item.teacherId;
      this.teacherName = item.teacherName;
    },
    /** 更新评分 */
    handleClueRate(rows) {
      customerClueRate(rows).then((res) => {
        if (res.code === 200) {
          this.$message.success("操作成功", 3);
          this.getList();
        }
      });
    },
    /** 查询左心房客户推送信息列表 */
    getList() {
      this.loading = true;
      const dateRangeEndTime = this.dateRangeEndTime; // 最后跟进时间
      var queryForm = this.addDateRange(this.queryParam, this.dateRange); // 推送时间
      if (
        dateRangeEndTime !== null &&
        dateRangeEndTime !== "" &&
        dateRangeEndTime.length === 2
      ) {
        queryForm.params["beginEndTime"] = dateRangeEndTime[0];
        queryForm.params["endEndTime"] = dateRangeEndTime[1];
      }
      if (this.tabkey === "receive") {
        console.log("queryForm", queryForm);
        findMyReceiveList(queryForm).then((response) => {
          this.bizCustomerReceiveList = response.data.list.map(
            (item, index) => {
              return { ...item, ispop: false, index: index };
            }
          );
          this.cusListIds = response.data.list.map((item, index) => {
            return { id: item.id, index: index, isAllowEdit: item.isAllowEdit };
          });
          this.total = response.data.total;
          this.loading = false;
        });
      } else if (this.tabkey === "zhuangku") {
        findZhuangKuList(queryForm).then((response) => {
          this.bizCustomerZkList = response.data.list.map((item, index) => {
            return { ...item, ispop: false, index: index };
          });
          this.cusListIds = response.data.list.map((item, index) => {
            return { id: item.id, index: index, isAllowEdit: item.isAllowEdit };
          });
          this.total = response.data.total;
          this.loading = false;
        });
      } else {
        listBizMyListCustomer(queryForm).then((response) => {
          this.bizCustomerList = response.data.list.map((item, index) => {
            return { ...item, ispop: false, index: index };
          });
          this.cusListIds = response.data.list.map((item, index) => {
            return { id: item.id, index: index };
          });
          this.total = response.data.total;
          this.loading = false;
        });
      }
    },
    // 转入我的客户
    handleZhuaMyCus(status) {
      var that = this;
      if (that.ids.length === 0) {
        that.$message.warning("请选择客户", 3);
        return;
      }
      this.$confirm({
        title: "确认要执行该操作?",
        onOk() {
          return updateStatus({
            ids: that.ids,
            status: status,
          }).then((res) => {
            that.onSelectChange([], []);
            that.getList();
            that.$message.success("操作成功", 3);
          });
        },
        onCancel() {},
      });
    },
    // 状态字典翻译
    businessStatusFormat(row) {
      if (row.businessStatus) {
        return this.selectDictLabel(
          this.businessStatusOptions,
          row.businessStatus
        );
      } else {
        return "";
      }
    },
    statusFormat(row) {
      if (row.status) {
        return this.selectDictLabel(this.statusOptions, row.status);
      } else {
        return "";
      }
    },
    typeFormat(row) {
      if (row.type) {
        return this.selectDictLabel(this.typeOptions, row.type);
      } else {
        return "";
      }
    },
    levelFormat(row) {
      if (row.level) {
        return this.selectDictLabel(this.levelOptions, row.level);
      } else {
        return "";
      }
    },
    busProgressFormat(row) {
      if (row.progress) {
        return this.selectDictLabel(this.progressOptions, row.progress);
      } else {
        return "";
      }
    },
    ownTpyeFormat(row) {
      if (row.ownType) {
        return this.selectDictLabel(this.ownTypeOptions, row.ownType);
      } else {
        return "";
      }
    },
    ownTpyeRemarkFormat(row) {
      if (row.ownType) {
        return this.selectDictLabelRemark(this.ownTypeOptions, row.ownType);
      } else {
        return "";
      }
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParam.pageNum = 1;
      this.getList();
    },
    /** 刷新按钮操作 */
    resetQuery() {
      this.queryParam = {
        pageNum: 1,
        pageSize: 10,
        status: "0",
        // orderByColumn: "createTime",
        // isAsc: "desc",
      };
      this.handleQuery();
    },
    /** 翻页操作 */
    onShowSizeChange(current, pageSize) {
      this.queryParam.pageSize = pageSize;
      this.getList();
    },
    /** 翻页操作 */
    onSizeChange(current, size) {
      this.queryParam.pageNum = 1;
      this.queryParam.pageSize = size;
      this.getList();
    },
    /** 翻页操作 */
    changeSize(current, pageSize) {
      this.queryParam.pageNum = current;
      this.queryParam.pageSize = pageSize;
      // this.getList();
    },
    /** 选择操作 */
    onSelectChange(selectedRowKeys, selectedRows) {
      this.selectedRowKeys = selectedRowKeys;
      this.selectedRows = selectedRows;
      this.ids = selectedRowKeys;
      this.single = selectedRowKeys.length !== 1;
      this.multiple = !selectedRowKeys.length;
    },
    /** 查询折叠和展开操作 */
    toggleAdvanced() {
      this.advanced = !this.advanced;
    },
    handleAdd() {
      this.showAddInfoModal = true;
      this.$nextTick(() => this.$refs.bizCustomerAddInfoForm.handleAdd("0"));
    },
    handleAddImportData() {
      this.showAddImportModal = true;
      this.$nextTick(() => this.$refs.bizCustomerAddForm.handleAddImport("0"));
    },
    handleUpdate(record, ids) {
      this.showEditModal = true;
      this.$nextTick(() =>
        this.$refs.bizCustomerEditForm.handleUpdate(record, ids)
      );
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      var that = this;
      const bizCustomerIds = row.id || this.ids;
      this.$confirm({
        title: "确认删除所选中数据?",
        onOk() {
          return delBizCustomer(bizCustomerIds).then(() => {
            that.onSelectChange([], []);
            that.getList();
            that.$message.success("删除成功", 3);
          });
        },
        onCancel() {},
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      var that = this;
      this.$confirm({
        title: "是否确认导出?",
        content: "此操作将导出当前条件下所有数据而非选中数据",
        onOk() {
          return exportBizCustomer(that.queryParam).then((response) => {
            that.download(response.msg);
            that.$message.success("导出成功", 3);
          });
        },
        onCancel() {},
      });
    },
    // 确认分配员工
    handleOk() {
      var that = this;
      this.confirmLoading = true;
      console.log("this.customerInfo.status", this.customerInfo.status);
      if (that.customerInfo.userId) {
        that.customerInfo.ids = that.ids;
        manualShareBatch(this.customerInfo).then((res) => {
          if (res.code === 200) {
            that.visible = false;
            that.onSelectChange([], []);
            that.getList();
            that.$message.success("分配成功！", 3);
          }
          this.confirmLoading = false;
        });
      } else {
        that.$message.warn("请选择员工！", 3);
      }
    },
    handleCancel() {
      this.visible = false;
    },
    // 锁客
    confirmHandleStatus(row) {
      const text = row.isLock === 1 ? "锁定" : "解锁";
      row.isLock = row.isLock === 0 ? 1 : 0;
      var params = { id: row.id, isLock: row.isLock };
      lockCustomer(params)
        .then((res) => {
          if (res.code === 200) {
            this.$message.success(text + "成功", 3);
            this.getList();
          }
        })
        .catch(function () {
          this.$message.error(text + "发生异常", 3);
        });
    },
    cancelHandleStatus(row) {},
  },
};
</script>
<style scoped lang="less">
.addJinjian {
  color: #fff;
  background-color: #67c23a;
  border-color: #67c23a;
}
.togonghai {
  color: #fff;
  background-color: #e6a23c;
  border-color: #e6a23c;
}
.xiansuochi {
  color: #fff;
  background-color: hsl(230, 77%, 57%);
  border-color: hsl(230, 77%, 57%);
}
.zhuanggeitaren {
  color: #fff;
  background-color: #269f70;
  border-color: #269f70;
}
.importcustomer {
  color: #fff;
  background-color: #a097f6;
  border-color: #a097f6;
}
.heimingdan {
  color: #fff;
  background-color: #909399;
  border-color: #909399;
}
.xiezhu {
  color: #fff;
  background-color: #097cef;
  border-color: #097cef;
}

.auto-width-form-item {
  display: flex;
  align-items: center;
}

.input-number-wrapper {
  display: flex;
  flex: 1; /* 填充剩余空间 */
  align-items: center;
  gap: 8px; /* 设置间距 */
  margin-bottom: 5px;
}

.auto-width-input {
  flex: 1; /* 自动填充剩余空间 */
  min-width: 0; /* 防止内容溢出 */
}

.separator {
  white-space: nowrap; /* 防止 ~ 换行 */
}
.ant-tag {
  margin-right: 1px;
}
</style>
